package com.ruoyi.course.service.impl;

import java.util.List;

import com.ruoyi.course.domain.CourseTeacher;
import com.ruoyi.course.mapper.CourseTeacherMapper;
import com.ruoyi.course.service.ICourseTeacherService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 用户信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-12
 */
@Service
public class CourseTeacherServiceImpl implements ICourseTeacherService
{
    @Autowired
    private CourseTeacherMapper courseTeacherMapper;

    /**
     * 查询用户信息
     * 
     * @param userId 用户信息主键
     * @return 用户信息
     */
    @Override
    public CourseTeacher selectSysUserByUserId(Long userId)
    {
        return courseTeacherMapper.selectSysUserByUserId(userId);
    }

    /**
     * 查询用户信息列表
     * 
     * @param courseTeacher 用户信息
     * @return 用户信息
     */
    @Override
    public List<CourseTeacher> selectSysUserList(CourseTeacher courseTeacher)
    {
        return courseTeacherMapper.selectSysUserList(courseTeacher);
    }

    /**
     * 新增用户信息
     * 
     * @param courseTeacher 用户信息
     * @return 结果
     */
    @Override
    public int insertSysUser(CourseTeacher courseTeacher)
    {
        courseTeacher.setCreateTime(DateUtils.getNowDate());
        int result = courseTeacherMapper.insertSysUser(courseTeacher);
        int i = courseTeacherMapper.insertTeacherRole(courseTeacher);
        if (i<=0){
            return i;
        }
        return result;
    }

    /**
     * 修改用户信息
     * 
     * @param courseTeacher 用户信息
     * @return 结果
     */
    @Override
    public int updateSysUser(CourseTeacher courseTeacher)
    {
        courseTeacher.setUpdateTime(DateUtils.getNowDate());
        return courseTeacherMapper.updateSysUser(courseTeacher);
    }

    /**
     * 批量删除用户信息
     * 
     * @param userIds 需要删除的用户信息主键
     * @return 结果
     */
    @Override
    public int deleteSysUserByUserIds(Long[] userIds)
    {
        return courseTeacherMapper.deleteSysUserByUserIds(userIds);
    }

    /**
     * 删除用户信息信息
     * 
     * @param userId 用户信息主键
     * @return 结果
     */
    @Override
    public int deleteSysUserByUserId(Long userId)
    {
        return courseTeacherMapper.deleteSysUserByUserId(userId);
    }

    @Override
    public List<CourseTeacher> selectTeacherId(CourseTeacher courseTeacher) {
        return courseTeacherMapper.selectTeacherId(courseTeacher);
    }
}
